Skip to main content

App Global Event

Description:

  The global signal slot (event system) communication features. This is just a demonstration record showing the global signal slot names and callbacks.

Usage:

-- Register for these events using codes:
local node = Node():addTo(Director.entry)
node:gslot("AppQuit", function()
print("Application is shuting down!")
end)

AppQuit

Type: Global Event.

Description:

  Triggers when the application is about to quit.

Signature:

["AppQuit"]: function()

AppLowMemory

Type: Global Event.

Description:

  Triggers when the application receives a low memory warning.

Signature:

["AppLowMemory"]: function()

AppWillEnterBackground

Type: Global Event.

Description:

  Triggers when the application is about to enter the background.

Signature:

["AppWillEnterBackground"]: function()

AppDidEnterBackground

Type: Global Event.

Description:

  Triggers when the application has entered the background.

Signature:

["AppDidEnterBackground"]: function()

AppWillEnterForeground

Type: Global Event.

Description:

  Triggers when the application is about to enter the foreground.

Signature:

["AppWillEnterForeground"]: function()

AppDidEnterForeground

Type: Global Event.

Description:

  Triggers when the application has entered the foreground.

Signature:

["AppDidEnterForeground"]: function()

AppSizeChanged

Type: Global Event.

Description:

  Triggers when the application window size changes.

Signature:

["AppSizeChanged"]: function()

AppFullScreen

Type: Global Event.

Description:

  Triggers when the application window enters or exits full-screen mode.

Signature:

["AppFullScreen"]: function(fullScreen: boolean)

AppMoved

Type: Global Event.

Description:

  Triggers when the application window position changes.

Signature:

["AppMoved"]: function()

AppTheme

Type: Global Event.

Description:

  Triggers when the application theme color changes.

Signature:

["AppTheme"]: function(themeColor: Color)

AppWSOpen

Type: Global Event.

Description:

  Triggers when a websocket connection is open.

Signature:

["AppWSOpen"]: function()

AppWSClose

Type: Global Event.

Description:

  Triggers when a websocket connection is closed.

Signature:

["AppWSClose"]: function()

AppWSMessage

Type: Global Event.

Description:

  Triggers when received text message from a websocket connection.

Signature:

["AppWSMessage"]: function(msg: string)

AppWSSend

Type: Global Event.

Description:

  A gobal event for broadcasting massage to all websocket connections.

Signature:

["AppWSSend"]: function(msg: string)

Usage:

emit "AppWSSend", "A message"